package com.eagle.roomcrawler.controller;

import com.eagle.roomcrawler.entity.User;
import com.eagle.roomcrawler.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class LoginController {

    @Autowired
    private UserMapper userMapper;

    @RequestMapping(value="/index")
    public String index() {
        return "login";
    }


    @RequestMapping(value="/login")
    @ResponseBody
    public List<User> login(User user ) {
        System.out.println(user);

        List<User> users = userMapper.findAll();

        return users;
    }
}